﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace WebApplication1
{
    public class DbHelep
    {
        private static readonly string Constring = "server=.;database=CMS;uid=sa;pwd=123456;";

        public static DataTable GetData(string sql )
        {
            SqlDataAdapter adapter = new SqlDataAdapter(sql, Constring);
            DataTable table = new DataTable();
            adapter.Fill(table);
            return table;
        }

        public static int CRUD(string sql)
        {
            SqlConnection connection = new SqlConnection(Constring);
            SqlCommand command = new SqlCommand(sql ,connection );
           
            connection.Open();
            var res = command.ExecuteNonQuery();
            connection.Close();
            return res;   
        }
    }
}